import { get } from 'lodash-es';
import { useUserInfoStore } from './userInfo.js';

export function getAreaLevel(level) {
  if (level === undefined) {
    const userInfoStore = useUserInfoStore();
    level = userInfoStore.area_code_level();
  }
  return level;
}

export function getAreaCode(params) {
  let area_code = get(params, 'area_code');
  if (!area_code) {
    const userInfoStore = useUserInfoStore();
    area_code = userInfoStore.area_code;
  }
  return area_code;
}
